package org.endy.leisure.diaTracker.repository

import org.endy.leisure.diaTracker.entity.User
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.JpaSpecificationExecutor
import org.springframework.stereotype.Repository

@Repository
interface UserRepository : JpaRepository<User, Long>, JpaSpecificationExecutor<User> {

    /**
     * 通过微信唯一ID查找用户信息
     */
    fun findUserByOpenIdOrPhone(openId: String? = null, phone: String? = null): User?

    /**
     * 通过手机号码查找用户信息
     */
    fun findUserByPhone(phone:String): User?

}